﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
using System.Globalization;

/// <summary>
/// INTPage 的摘要说明
/// </summary>
public class INTPage : Page
{
    public INTPage()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }
    /// <summary>
    /// 本地化
    /// </summary>
    //protected override void InitializeCulture()
    //{
    //    String language = Request.QueryString["curlanguage"];
    //    if (!String.IsNullOrEmpty(language))
    //    {
    //        //UICulture - 决定了采用哪一种本地化资源，也就是使用哪种语言
    //        //Culture - 决定各种数据类型是如何组织，如数字与日期
    //        Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
    //        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(language);
    //    }
    //}
    public string s = "zh-cn";
    protected override void InitializeCulture()
    {
        String language = Request.QueryString["curlanguage"];
        if (!String.IsNullOrEmpty(language))
        {
            switch (language)
            {
                case "zh-cn":
                    {
                        Session["Language"] = language;
                        break;
                    }
                case "en-us":
                    {
                        Session["Language"] = language;
                        break;
                    }
            }
        }
        else if(Session["Language"]==null)
        {
            Session["Language"] = "zh-cn";
        }
        //if (Session["Language"] != null)
        //{
        //    s = Session["Language"].ToString();
        //}
        if (!String.IsNullOrEmpty(Session["Language"].ToString()))
        {
            //UICulture - 决定了采用哪一种本地化资源，也就是使用哪种语言
            //Culture - 决定各种数据类型是如何组织，如数字与日期
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(Session["Language"].ToString());
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Session["Language"].ToString());
        }
    }
}
